From f413d5ef22fc31e153c9eccac1858f7e1c37d727 Mon Sep 17 00:00:00 2001 From: Alexander Mikhaylenko Date: Mon, 3 May 2021 19:03:47 +0500 Subject: [PATCH] textlayout: Only special case selection rendering for opaque colors If the selection is partially transparent, it may still be desirable to see the colors from tags underneath. --- gtk/gtktextlayout.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index d127c489b2..b31c70799e 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -3873,8 +3873,12 @@ render_para (GskPangoRenderer *crenderer, if (at_last_line) selection_height += line_display->bottom_margin; + /* Don't draw the text underneath if the whole line is selected. We can + * only do it if the selection is opaque. + */ if (selection_start_index < byte_offset && - selection_end_index > line->length + byte_offset) /* All selected */ + selection_end_index > line->length + byte_offset && + selection->alpha >= 1) { gtk_snapshot_append_color (crenderer->snapshot, selection, -- 2.30.2